package com.niiwoo.civet.trade.report.client.report.test;

/**
 * 本测试DEMO 仅作为参考，
 * 对于压缩后特别大的数据文件 不建议 网络传输。
 * @version 20180906
 * www.resoft.css.com.cn
 * @author wanglei
 *
 */
public class AppMain {
/**
	public static void main(String[] args) throws IOException {

		String filePath = "E:\\data";
		String companyCode = "91110108101194908R";
		String companyType = "p2p";

		//初始化对象
		AppMain test = new AppMain();
		ReportToTxtUtil reportToTxtUtil = new ReportToTxtUtil(filePath,companyCode,companyType);

		//j1001测试
		reportToTxtUtil.initReportInfo("d","j1001","20180531");
		test.testData(reportToTxtUtil);
		//j1002测试
		reportToTxtUtil.initReportInfo("d","j1002","20180531");
		test.testData(reportToTxtUtil);
		//j1003测试
		reportToTxtUtil.initReportInfo("d","j1003","20180531");
		test.testData(reportToTxtUtil);
		//j1004测试
		reportToTxtUtil.initReportInfo("d","j1004","20180531");
		test.testData(reportToTxtUtil);
		//j1005测试
		reportToTxtUtil.initReportInfo("d","j1005","20180531");
		test.testData(reportToTxtUtil);
		//j1006测试
		reportToTxtUtil.initReportInfo("d","j1006","20180531");
		test.testData(reportToTxtUtil);

	}

	public void testData(ReportToTxtUtil reportToTxtUtil) throws IOException{
		//打开压缩流
		ZipOutputStream zipOutputStream = reportToTxtUtil.getZipOutputStream();

		Long startTime = System.currentTimeMillis();

		Long dataStartTime = 0L; Long dataEndTime = 0L ;
		//模拟分页
		for(int i = 0 ;i<100;i++){
			dataStartTime = System.currentTimeMillis();
			//分页数据写到压缩包中
			if("j1001".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1001Data());
			}else if("j1002".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1002Data());
			}else if("j1003".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1003Data());
			}else if("j1004".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1004Data());
			}else if("j1005".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1005Data());
			}else if("j1006".equals(reportToTxtUtil.getReportCode())){
				reportToTxtUtil.dataWriteToZipFile1(zipOutputStream, DateReportDataService.getJ1006Data());
			}else{
				throw new RuntimeException("未知的报表！");
			}
			dataEndTime = System.currentTimeMillis();
			System.out.println(i+"_页写入共耗时："+(dataEndTime-dataStartTime)+"毫秒");
		}
		//关闭压缩流 必须
		reportToTxtUtil.closeZipOutputStream(zipOutputStream);

		Long endTime = System.currentTimeMillis();
		System.out.println("操作完成共耗时："+(endTime-startTime)+"毫秒");
	}
 **/
}
